package com.itheima.controller;

import com.itheima.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class AnalysisController {

    @Autowired
    AnalysisManager analysisManager;

    //首页最上面统计
    @GetMapping("/dashboard/summary")
    public ResponseEntity findSummary(){
       return analysisManager.findSummary();
    }

    /**
     * 新增、活跃用户、次日留存率
     * @param sd
     * @param ed
     * @param type
     * @return
     */
    @GetMapping("/dashboard/users")
    public ResponseEntity users(Long sd,Long ed,Integer type){
        Map map = analysisManager.users(sd,ed,type);
        return ResponseEntity.ok(map);
    }

}
